Use g_autoptr(GBytes) instead of gs_unref_bytes
authorMatthew Barnes <mbarnes@redhat.com>
Tue, 5 May 2015 15:41:50 +0000 (11:41 -0400)
committerMatthew Barnes <mbarnes@redhat.com>
Thu, 7 May 2015 02:07:10 +0000 (22:07 -0400)
src/libostree/ostree-bootconfig-parser.c
src/libostree/ostree-bootloader-syslinux.c
src/libostree/ostree-bootloader-uboot.c
src/libostree/ostree-fetcher.c
src/libostree/ostree-repo-commit.c
src/libostree/ostree-repo-pull.c
src/libostree/ostree-repo-static-delta-compilation.c
src/libostree/ostree-repo-static-delta-core.c
src/libostree/ostree-repo-static-delta-processing.c
src/libostree/ostree-repo.c
src/libostree/ostree-sysroot-deploy.c

index 43f36caa1e39d51a04eaa8ef1c6118e00fc98228..44e9ce8041e4e19842fb7ad5d9659a4a14df804e 100644 (file)
@@ -169,7 +169,7 @@ ostree_bootconfig_parser_write (OstreeBootconfigParser   *self,
   GHashTableIter hashiter;
   gpointer hashkey, hashvalue;
   GString *buf = g_string_new ("");
-  gs_unref_bytes GBytes *bytes = NULL;
+  g_autoptr(GBytes) bytes = NULL;
   guint i;
   gs_unref_hashtable GHashTable *written_overrides = NULL;
 
index 0a083f312f02158cf474671374fb418489d8a30f..72d9d1fca3abd9550eb7009da05c99662aff710e 100644 (file)
@@ -247,7 +247,7 @@ _ostree_bootloader_syslinux_write_config (OstreeBootloader          *bootloader,
 
   new_config_contents = _ostree_sysroot_join_lines (new_lines);
   {
-    gs_unref_bytes GBytes *new_config_contents_bytes =
+    g_autoptr(GBytes) new_config_contents_bytes =
       g_bytes_new_static (new_config_contents,
                           strlen (new_config_contents));
 
index 7e71ab9eff37bd891a5684bb2b094dfdaf9373bb..00ec2d6921ca78d742e48da94176d5c153aa0326 100644 (file)
@@ -129,7 +129,7 @@ _ostree_bootloader_uboot_write_config (OstreeBootloader          *bootloader,
 
   new_config_contents = _ostree_sysroot_join_lines (new_lines);
   {
-    gs_unref_bytes GBytes *new_config_contents_bytes =
+    g_autoptr(GBytes) new_config_contents_bytes =
       g_bytes_new_static (new_config_contents,
                           strlen (new_config_contents));
 
index c50a096400750578cf29e05d213c204be71fb991..e7dc00de10ab4a63593e9a9ae264b922df3b51a8 100644 (file)
@@ -380,7 +380,7 @@ on_stream_read (GObject        *object,
                 gpointer        user_data) 
 {
   OstreeFetcherPendingURI *pending = user_data;
-  gs_unref_bytes GBytes *bytes = NULL;
+  g_autoptr(GBytes) bytes = NULL;
   gsize bytes_read;
   GError *local_error = NULL;
   GError **error = &local_error;
index d26f00e8db49fca76a464ce642aedb61840779ba..bb1cef28e5cdf16c7bcb97e13c5edf9e5989c4a5 100644 (file)
@@ -597,7 +597,7 @@ write_object (OstreeRepo         *self,
       if (repo_mode == OSTREE_REPO_MODE_BARE_USER && object_is_symlink)
         {
           const char *target_str = g_file_info_get_symlink_target (file_info);
-          gs_unref_bytes GBytes *target = g_bytes_new (target_str, strlen (target_str) + 1);
+          g_autoptr(GBytes) target = g_bytes_new (target_str, strlen (target_str) + 1);
 
           /* For bare-user we can't store symlinks as symlinks, as symlinks don't
              support user xattrs to store the ownership. So, instead store them
index 0758970be922892f442cf7924201aa55326ad948..433f3f5eb371d3820cb988f13e37103517fa8ec7 100644 (file)
@@ -323,7 +323,7 @@ fetch_uri_contents_utf8_sync (OtPullData  *pull_data,
                               GError     **error)
 {
   gboolean ret = FALSE;
-  gs_unref_bytes GBytes *bytes = NULL;
+  g_autoptr(GBytes) bytes = NULL;
   g_autofree char *ret_contents = NULL;
   gsize len;
 
@@ -519,7 +519,7 @@ lookup_commit_checksum_from_summary (OtPullData    *pull_data,
   gs_unref_variant GVariant *commit_data = NULL;
   guint64 commit_size;
   gs_unref_variant GVariant *commit_csum_v = NULL;
-  gs_unref_bytes GBytes *commit_bytes = NULL;
+  g_autoptr(GBytes) commit_bytes = NULL;
   int i;
   
   if (!ot_variant_bsearch_str (refs, ref, &i))
@@ -895,7 +895,7 @@ static_deltapart_fetch_on_complete (GObject           *object,
 
   {
     GMappedFile *mfile = NULL;
-    gs_unref_bytes GBytes *delta_data = NULL;
+    g_autoptr(GBytes) delta_data = NULL;
 
     mfile = g_mapped_file_new_from_fd (fd, FALSE, error);
     if (!mfile)
@@ -1311,7 +1311,7 @@ fetch_metadata_to_verify_delta_superblock (OtPullData      *pull_data,
 {
   gboolean ret = FALSE;
   g_autofree char *meta_path = _ostree_get_relative_static_delta_detachedmeta_path (from_revision, checksum);
-  gs_unref_bytes GBytes *detached_meta_data = NULL;
+  g_autoptr(GBytes) detached_meta_data = NULL;
   SoupURI *target_uri = NULL;
   gs_unref_variant GVariant *metadata = NULL;
 
@@ -1351,8 +1351,8 @@ request_static_delta_superblock_sync (OtPullData  *pull_data,
   gs_unref_variant GVariant *ret_delta_superblock = NULL;
   g_autofree char *delta_name =
     _ostree_get_relative_static_delta_superblock_path (from_revision, to_revision);
-  gs_unref_bytes GBytes *delta_superblock_data = NULL;
-  gs_unref_bytes GBytes *delta_meta_data = NULL;
+  g_autoptr(GBytes) delta_superblock_data = NULL;
+  g_autoptr(GBytes) delta_meta_data = NULL;
   gs_unref_variant GVariant *delta_superblock = NULL;
   SoupURI *target_uri = NULL;
   
@@ -1907,7 +1907,7 @@ ostree_repo_pull_with_options (OstreeRepo             *self,
   if (pull_data->is_mirror && !refs_to_fetch && !configured_branches)
     {
       SoupURI *summary_uri = NULL;
-      gs_unref_bytes GBytes *bytes = NULL;
+      g_autoptr(GBytes) bytes = NULL;
       g_autofree char *ret_contents = NULL;
       
       summary_uri = suburi_new (pull_data->base_uri, "summary", NULL);
index 854008f3ac00a742056044cd60a64f6a91a8ec85..b2e206e853e27aff775308802ba50a93a66d042f 100644 (file)
@@ -455,7 +455,7 @@ get_unpacked_unlinked_content (OstreeRepo       *repo,
   gboolean ret = FALSE;
   g_autofree char *tmpname = g_strdup ("tmpostree-deltaobj-XXXXXX");
   gs_fd_close int fd = -1;
-  gs_unref_bytes GBytes *ret_content = NULL;
+  g_autoptr(GBytes) ret_content = NULL;
   g_autoptr(GInputStream) istream = NULL;
   g_autoptr(GFileInfo) ret_finfo = NULL;
   g_autoptr(GOutputStream) out = NULL;
@@ -506,8 +506,8 @@ try_content_bsdiff (OstreeRepo                       *repo,
   gboolean ret = FALSE;
   gs_unref_hashtable GHashTable *from_bsdiff = NULL;
   gs_unref_hashtable GHashTable *to_bsdiff = NULL;
-  gs_unref_bytes GBytes *tmp_from = NULL;
-  gs_unref_bytes GBytes *tmp_to = NULL;
+  g_autoptr(GBytes) tmp_from = NULL;
+  g_autoptr(GBytes) tmp_to = NULL;
   g_autoptr(GFileInfo) from_finfo = NULL;
   g_autoptr(GFileInfo) to_finfo = NULL;
   ContentBsdiff *ret_bsdiff = NULL;
@@ -548,8 +548,8 @@ try_content_rollsum (OstreeRepo                       *repo,
   gboolean ret = FALSE;
   gs_unref_hashtable GHashTable *from_rollsum = NULL;
   gs_unref_hashtable GHashTable *to_rollsum = NULL;
-  gs_unref_bytes GBytes *tmp_from = NULL;
-  gs_unref_bytes GBytes *tmp_to = NULL;
+  g_autoptr(GBytes) tmp_from = NULL;
+  g_autoptr(GBytes) tmp_to = NULL;
   g_autoptr(GFileInfo) from_finfo = NULL;
   g_autoptr(GFileInfo) to_finfo = NULL;
   OstreeRollsumMatches *matches = NULL;
@@ -1301,8 +1301,8 @@ ostree_repo_static_delta_generate (OstreeRepo                   *self,
       GBytes *operations_b;
       g_autofree guchar *part_checksum = NULL;
       g_autoptr(GChecksum) checksum = NULL;
-      gs_unref_bytes GBytes *objtype_checksum_array = NULL;
-      gs_unref_bytes GBytes *checksum_bytes = NULL;
+      g_autoptr(GBytes) objtype_checksum_array = NULL;
+      g_autoptr(GBytes) checksum_bytes = NULL;
       g_autoptr(GFile) part_tempfile = NULL;
       g_autoptr(GOutputStream) part_temp_outstream = NULL;
       g_autoptr(GInputStream) part_in = NULL;
index 264a8893037c8c0a678a9d280c6de887912ddc4e..63e4d7febbce94cdbc86bcd5b32cf3ecb0fb5a9f 100644 (file)
@@ -318,7 +318,7 @@ ostree_repo_static_delta_execute_offline (OstreeRepo                    *self,
 
       {
         GMappedFile *mfile = gs_file_map_noatime (part_path, cancellable, error);
-        gs_unref_bytes GBytes *bytes = NULL;
+        g_autoptr(GBytes) bytes = NULL;
 
         if (!mfile)
           goto out;
index 32e6157ed78f653dc2d07d928cb436f55ca44d39..8c627570a22e5638e5c6147487d20c18b8099e37 100644 (file)
@@ -319,8 +319,8 @@ _ostree_static_delta_part_execute (OstreeRepo      *repo,
   gboolean ret = FALSE;
   gsize partlen;
   const guint8*partdata;
-  gs_unref_bytes GBytes *part_payload_bytes = NULL;
-  gs_unref_bytes GBytes *payload_data = NULL;
+  g_autoptr(GBytes) part_payload_bytes = NULL;
+  g_autoptr(GBytes) payload_data = NULL;
   gs_unref_variant GVariant *payload = NULL;
   guint8 comptype;
 
index a03e894cbd3268c1f059300d3f295bf7dca343ab..d21124ff1d2c8e81076932d1f1cd4716b98876d3 100644 (file)
@@ -2032,7 +2032,7 @@ ostree_repo_load_file (OstreeRepo         *self,
             {
               guint32 mode;
               gs_unref_variant GVariant *metadata = NULL;
-              gs_unref_bytes GBytes *bytes = NULL;
+              g_autoptr(GBytes) bytes = NULL;
               gs_fd_close int fd = -1;
 
               bytes = ot_lgetxattrat (self->objects_dir_fd, loose_path_buf,
@@ -3103,7 +3103,7 @@ sign_data (OstreeRepo     *self,
   g_autoptr(GFile) tmp_signature_file = NULL;
   g_autoptr(GOutputStream) tmp_signature_output = NULL;
   gpgme_ctx_t context = NULL;
-  gs_unref_bytes GBytes *ret_signature = NULL;
+  g_autoptr(GBytes) ret_signature = NULL;
   gpgme_engine_info_t info;
   gpgme_error_t err;
   gpgme_key_t key = NULL;
@@ -3248,8 +3248,8 @@ ostree_repo_sign_commit (OstreeRepo     *self,
                          GError        **error)
 {
   gboolean ret = FALSE;
-  gs_unref_bytes GBytes *commit_data = NULL;
-  gs_unref_bytes GBytes *signature = NULL;
+  g_autoptr(GBytes) commit_data = NULL;
+  g_autoptr(GBytes) signature = NULL;
   gs_unref_variant GVariant *commit_variant = NULL;
   gs_unref_variant GVariant *old_metadata = NULL;
   gs_unref_variant GVariant *new_metadata = NULL;
@@ -3342,8 +3342,8 @@ ostree_repo_sign_delta (OstreeRepo     *self,
                         GError        **error)
 {
   gboolean ret = FALSE;
-  gs_unref_bytes GBytes *delta_data = NULL;
-  gs_unref_bytes GBytes *signature_data = NULL;
+  g_autoptr(GBytes) delta_data = NULL;
+  g_autoptr(GBytes) signature_data = NULL;
   gs_unref_variant GVariant *commit_variant = NULL;
   g_autofree char *delta_path = NULL;
   g_autoptr(GFile) delta_file = NULL;
@@ -3537,7 +3537,7 @@ ostree_repo_verify_commit_ext (OstreeRepo    *self,
   gs_unref_variant GVariant *commit_variant = NULL;
   g_autoptr(GFile) keyringdir_ref = NULL;
   gs_unref_variant GVariant *metadata = NULL;
-  gs_unref_bytes GBytes *signed_data = NULL;
+  g_autoptr(GBytes) signed_data = NULL;
   g_autofree char *commit_filename = NULL;
 
   /* Create a temporary file for the commit */
index 5e1ec44559981ccb3e6fdf6ed292b857bb9ee992..34ab23ebca61f438fd098c8a6837db733621881c 100644 (file)
@@ -853,7 +853,7 @@ ostree_sysroot_write_origin_file (OstreeSysroot         *sysroot,
       g_autoptr(GFile) origin_parent = g_file_get_parent (origin_path);
       g_autofree char *contents = NULL;
       gsize len;
-      gs_unref_bytes GBytes *contents_bytes = NULL;
+      g_autoptr(GBytes) contents_bytes = NULL;
 
       contents = g_key_file_to_data (origin, &len, error);
       if (!contents)